using System.ComponentModel.DataAnnotations;

namespace Terra.Core.Common.Models.Pagination;

/// <summary>
/// 分页请求基类
/// </summary>
public abstract class PagedRequest
{
    /// <summary>
    /// 页码
    /// </summary>
    [Range(1, int.MaxValue, ErrorMessage = "页码必须大于0")]
    public int PageIndex { get; set; } = 1;

    /// <summary>
    /// 每页大小
    /// </summary>
    [Range(1, 100, ErrorMessage = "每页大小必须在1-100之间")]
    public int PageSize { get; set; } = 20;

    /// <summary>
    /// 排序字段
    /// </summary>
    [MaxLength(50)]
    public string OrderBy { get; set; }

    /// <summary>
    /// 是否降序
    /// </summary>
    public bool IsDescending { get; set; } = true;

    /// <summary>
    /// 搜索关键字
    /// </summary>
    public string Keyword { get; set; }
}